package com.realestate.services;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.realestate.constants.ComTxManagerName;
import com.realestate.dao.DistrictDao;
import com.realestate.model.BrtbDistrict;

@Service
public class DistrictServiceImpl implements DistrictService{
	
	@SuppressWarnings("unused")
	private static final Logger LOGGER = Logger.getLogger(DistrictServiceImpl.class);
	
	@Autowired
    private DistrictDao districtDao;

	@Transactional(value = ComTxManagerName.COM_TRANSACTION_MANAGER)
	@Override
	public List<BrtbDistrict> getDistrictByProvinceCode(String provinceCode) {
		List<BrtbDistrict> districts= districtDao.getDistrictByProvinceCode(provinceCode);
		return districts;
	}

	@Override
	public BrtbDistrict getDistrictByCode(String code) {
		return districtDao.getDistrictByDistrictCode(code);
	}

	public List<BrtbDistrict> getAllDistricts(){
		return districtDao.getAllDistricts();
	}
}
